#ifndef ALFS_GUI_IMPL_WXWIDGETS_WXLIB_ENVELOPE_H
#define ALFS_GUI_IMPL_WXWIDGETS_WXLIB_ENVELOPE_H

#include    "wrapped/wx_h.h"

// TODO:
//IMPLEMENT_WX_THEME_SUPPORT

namespace alfs { namespace detail { namespace wxLib {

    class Envelope;

    class Envelope_SetApplicationObject
    {
    friend class Envelope;
    private:
        Envelope_SetApplicationObject( wxApp* newApp )
        {
            wxApp::SetInstance( newApp );
        }
    };

    class Envelope
        : private Envelope_SetApplicationObject
        , private wxInitializer
    {
    private:
        static wchar_t** args()
        {
            static wchar_t*  theArgs[] = { L"program name", L"" };
            return theArgs;
        }

    public:
        Envelope()
            : Envelope_SetApplicationObject( new wxApp )
            , wxInitializer( 1, args() )
        {
            // TODO:
    //    wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE,         
    //                                    "your program");                    
    //     wxTheApp->CallOnInit();     // Command line argument parsing.
        }

        // Destructor invokes wxInitializer destructor which does some cleanup.
    };

    struct Client
    {
        Client()
        {
            static Envelope theEnvelope;
        }
    };

} } }  // alfs::detail::wxLib

#endif
